/**
 * 
 */
package nju.bean.meeting.gui;

import java.awt.BorderLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import nju.bean.meeting.UML.MultiProperty;

/**
 * @author gongshw
 *
 */
@SuppressWarnings("serial")
public class MultiPropertyEditor extends JPanel {
	MultiProperty property;
	private JPanel headPanel = new JPanel();
	private JLabel nameLable ;
	private JTextArea propertyArea= new JTextArea();
	
	protected MultiPropertyEditor(MultiProperty multiProperty){
		property = multiProperty;
		nameLable = new JLabel(multiProperty.getName());
		initial();
	}
	
	private void initial() {
		setLayout(new BorderLayout());
		headPanel.add(nameLable);
		add(headPanel,BorderLayout.NORTH);
		propertyArea.setText(property.getValueString());
		add(propertyArea,BorderLayout.CENTER);
	}

	protected void apply() {
		String va[] = propertyArea.getText().split("\n");
		property.clearAll();
		for (String string : va) {
			property.addValue(string);
		}
	}
}
